<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="my" tagdir="/WEB-INF/tags/"%>
<c:set var="contextPath" value="${pageContext.servletContext.contextPath}"></c:set>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="./css/bootstrap.css" />
<script type="text/javascript" src="./js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="./js/bootstrap.js"></script>
<script type="text/javascript">
	function deleteaccount() {
		test.submit();
	}
	function selectAll() {
		var checklist = document.getElementsByName("accountid");
		if (document.getElementById("accountidAll").checked) {
			for (var i = 0; i < checklist.length; i++) {
				checklist[i].checked = true;
			}
		} else {
			for (var j = 0; j < checklist.length; j++) {
				checklist[j].checked = false;
			}
		}
	}
</script>

<div class="row"
			style="background-image: url('./img/top01.gif'); background-repeat: repeat-x; height: 40px">
			<div class="col-md-5">
				<img src="./img/icon1.gif" />${currentUser.loginname}的账户：
			</div>
			<div class="col-md-2" style="float: right">
				<button type="button" class="btn btn-link " data-toggle="modal"
					data-target="#myAccount">添加新的信用卡</button>
			</div>
			<my:account></my:account>
		</div>
		<div class="row" style="background: #075885">
			<div style="background-image: url('./img/top01.gif'); background-repeat: repeat-x; height: 40px"></div>
		</div>
		<c:if test="${accounts == null || accounts.size() == 0}">
			<div style="text-align: center" >
				<h2>
					还没有您的信用卡信息，请进行添加操作！
				</h2>
			</div>
		</c:if>
		<c:if test="${accounts != null && accounts.size() != 0}">
			<div class="table-responsive">
				<form id="test" action="deleteaccount.do" method="post">
					<table id="mytable" class="table table-hover"
						style="text-align: center">
						<tr>
							<td>删除</td>
							<td>卡号</td>
							<td>余额</td>
							<td>操作</td>
						</tr>
						<c:forEach var="item" varStatus="status" items="${accounts}">
							<tr>
								<td><input type="checkbox" name="accountid" value="${item.id}" /></td>
								<td>${item.creditcard}</td>
								<td>￥${item.balance}</td>
								<td><a href="./deleteaccount.do?id=${item.id}">删除</a></td>
							</tr>
						</c:forEach>
						<tr>
							<td><input type="checkbox" onclick="selectAll()"
								id="accountidAll" />全选</td>
							<td><a href="#" style="float: left"
								onclick="deleteaccount()">删除选中信用卡</a></td>
							<td><a href="list.htm">继续购物</a></td>
							<td></td>
						</tr>
					</table>
				</form>
			</div>

		</c:if>